home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n06.arc / STRU.PRG < prev    next >
Text File  |  1991-03-06  |  1KB  |  64 lines

  1.  
  2.  
  3. * STRU.PRG list structure of database to screen or
  4. * to a text file.
  5. *
  6.  
  7. PARAMETERS param1, param2
  8. CLEAR SCREEN
  9. IF TYPE("param1") <> "C"
  10.    param1 = ""
  11.    ? "SYNTAX: STRU <dbf filename> {output filename}"
  12.    QUIT
  13. ENDIF
  14. IF TYPE("param2") <> "C"
  15.    param2 = ""
  16. ENDIF
  17. IF "." $ param1
  18.    param1 = SUBSTR(param1,1,AT(".",param1)-1)
  19. ENDIF
  20. IF .NOT. FILE(param1+".dbf")
  21.    ? "DATABASE FILE "+param1+" NOT FOUND"
  22.    QUIT
  23. ENDIF
  24. USE ¶m1
  25. COPY TO temp STRUCTURE EXTENDED
  26. USE temp
  27. LIST field_name,field_type,field_len,field_dec TO FILE temp1234.xx1
  28. ? ""
  29. ? ""
  30. IF LEN(param2) > 0
  31.    IF FILE(param2)
  32.       STORE SPACE(1) TO choice
  33.       loc = ROW()
  34.       @ loc,00  SAY param2 + ;
  35.     " Is About To Be OVERWRITTEN.... A)ppend.. R)ename.. F)ORGET..: "
  36.       @ loc,COL() GET choice PICTURE "!" VALID choice = "A" .OR. ;
  37.           choice = "R" .OR. choice = "F"
  38.       READ
  39.       IF choice = "A"
  40.          ? ""
  41.          RUN COPY ¶m2+temp1234.xx1 ¶m2 >nul
  42.          ERASE temp1234.xx1
  43.       ENDIF
  44.       IF choice = "R"
  45.          STORE SPACE(12) TO fname
  46.          ? ""
  47.          ? ""
  48.          @ loc+2,00 SAY "ENTER A NEW VALID FILENAME..:" GET ;
  49.               fname PICTURE "!!!!!!!!!!!"
  50.          READ
  51.          RENAME temp1234.xx1 TO &fname
  52.       ENDIF
  53.    ELSE
  54.       RENAME temp1234.xx1 TO ¶m2
  55.    ENDIF
  56. ELSE
  57.    RUN del temp1234.x* >nul
  58. ENDIF
  59. CLOSE ALL
  60. ERASE temp.dbf
  61. RETURN
  62.  
  63.  
  64.